
import java.awt.Color;
import java.awt.Cursor;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;

import javax.swing.ImageIcon;
import javax.swing.JColorChooser;
import javax.swing.JLabel;
import javax.swing.JTextField;


public class playersInfoEntry extends JLabel implements MouseListener
{
	ImageIcon playersInfoEntryBorder = new ImageIcon("images/border.png");
	ImageIcon color = new ImageIcon("images/color.png");
	ImageIcon forwardImage = new ImageIcon("images/forward.png");
	ImageIcon backImage = new ImageIcon("images/back.png");

	JTextField firstPlayerName;
	JTextField secondPlayerName;

	JLabel firstPlayerColor;
	JLabel secondPlayerColor;
	JLabel forward;
	JLabel back;

	Color firstColor;
	Color secondColor;

	public playersInfoEntry()
	{
		super();
		setIcon(playersInfoEntryBorder);
		setBounds(10, 100, 300, 300);
		setVisible(true);

		firstPlayerName = new JTextField("Player 1");
		firstPlayerName.setBounds(75, 30, 150, 20);
		firstPlayerName.setBackground(new Color(70, 184, 38));
		add(firstPlayerName);

		firstPlayerColor = new JLabel(color);
		firstPlayerColor.setBounds(125, 60, 50, 50);
		firstPlayerColor.setCursor(new Cursor(12));
		firstPlayerColor.addMouseListener(this);
		add(firstPlayerColor);

		secondPlayerName = new JTextField("Player 2");
		secondPlayerName.setBounds(75, 180, 150,20);
		secondPlayerName.setBackground(new Color(70, 184,38));
		add(secondPlayerName);

		secondPlayerColor = new JLabel(color);
		secondPlayerColor.setBounds(125, 210, 50, 50);
		secondPlayerColor.setCursor(new Cursor(12));
		secondPlayerColor.addMouseListener(this);
		add(secondPlayerColor);

		forward = new JLabel(forwardImage);
		forward.setBounds(230, 240, 40, 35);
		forward.setCursor(new Cursor(12));
		forward.setToolTipText("Start Game");
		forward.addMouseListener(this);
		add(forward);

		back = new JLabel(backImage);
		back.setBounds(30, 240, 40, 35);
		back.setCursor(new Cursor(12));
		back.setToolTipText("Back");
		back.addMouseListener(this);
		add(back);
		
	}

	public void mouseClicked(MouseEvent e)
	{
		
	}

	public void mouseEntered(MouseEvent e)
	{
		ImageIcon colorHover = new ImageIcon("images/colorHover.png");
		ImageIcon forwardHover = new ImageIcon("images/forwardHover.png");
		ImageIcon backHover = new ImageIcon("images/backHover.png");

		if(e.getSource() == firstPlayerColor)
		{
			firstPlayerColor.setIcon(colorHover);
		}
		else
		{
			if(e.getSource() == secondPlayerColor)
			{
				secondPlayerColor.setIcon(colorHover);
			}
			else
			{
				if(e.getSource() == forward)
				{
					forward.setIcon(forwardHover);
				}
				else
				{
					if(e.getSource() == back)
					{
						back.setIcon(backHover);
					}
				}
			}
		}
	}

	public void mouseExited(MouseEvent e)
	{
		firstPlayerColor.setIcon(color);
		secondPlayerColor.setIcon(color);
		forward.setIcon(forwardImage);
		back.setIcon(backImage);
	}

	public void mousePressed(MouseEvent e)
	{
	}

	public void mouseReleased(MouseEvent e)
	{	
	}
}
